<template>
  <div class="frequentlyAskedQuestion p-[30px] rounded-[8px]">
    <div class="flex justify-between">
      <span class="font-bold">最近登录记录</span
      ><span class="name"
        ><van-icon
          name="location-o"
          class="mr-[5px]"
        />当前位置：账户安全-登录日志-最近登录记录</span
      >
    </div>
    <el-divider />
    <div class="mt-[10px]">
      <div class="flex justify-between">
        <div>
          <span class="demonstration">日期：</span>
          <el-date-picker
            v-model="searchDate"
            type="date"
            placeholder="请选择日期"
          />
        </div>
        <div>
          <el-button type="primary" :icon="Search">查询</el-button>
          <el-button :icon="RefreshRight">重置</el-button>
        </div>
      </div>
      <div class="mt-[20px]">
        <el-table
          :data="tableData"
          style="width: 100%"
          :header-cell-style="{
            'background-color': 'var(--color-main-background)',
            color: 'var(--color-main-text-secondary)',
            'font-weight': 'normal'
          }"
        >
          <el-table-column prop="sort" label="" width="80" />
          <el-table-column prop="date" label="登录时间" />
          <el-table-column prop="ip" label="登录ip" />
          <el-table-column prop="type" label="登录方式" />
          <el-table-column prop="status" label="登录状态" />
        </el-table>
      </div>
      <div class="mt-[10px] flex justify-end">
        <el-pagination
          v-model:current-page="currentPage"
          v-model:page-size="pageSize"
          :page-sizes="[10, 50, 100]"
          layout="total, prev, pager, next, sizes, jumper"
          :total="5611"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { Search, RefreshRight } from "@element-plus/icons-vue";
import { ref } from "vue";
let searchDate = ref<string>("");
let currentPage = ref<number>(1);
let pageSize = ref<number>(10);
let tableData = ref([
  {
    sort: 1,
    date: "2023-08-14 12:00:00",
    ip: "192.168.3.1",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 2,
    date: "2023-08-13 12:01:10",
    ip: "172.168.0.2",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 3,
    date: "2023-08-13 13:00:00",
    ip: "192.168.1.12",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 4,
    date: "2023-08-13 19:03:01",
    ip: "162.168.1.1",
    type: "认证后台登录",
    status: "成功"
  },
  {
    sort: 5,
    date: "2023-08-13 15:01:02",
    ip: "192.168.0.1",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 6,
    date: "2023-08-12 01:40:09",
    ip: "192.168.0.11",
    type: "认证后台登录",
    status: "成功"
  },
  {
    sort: 7,
    date: "2023-08-12 15:07:14",
    ip: "192.168.0.1",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 8,
    date: "2023-08-13 12:00:00",
    ip: "192.168.0.1",
    type: "认证后台登录",
    status: "成功"
  },
  {
    sort: 9,
    date: "2023-08-13 12:00:00",
    ip: "192.168.0.1",
    type: "密码登录",
    status: "成功"
  },
  {
    sort: 10,
    date: "2023-08-13 12:00:00",
    ip: "192.168.0.1",
    type: "认证后台登录",
    status: "成功"
  }
]);
const handleSizeChange = (val: number) => {
  console.log(`${val} items per page`);
};
const handleCurrentChange = (val: number) => {
  console.log(`current page: ${val}`);
};
</script>

<style lang="scss" scoped>
.frequentlyAskedQuestion {
  height: 100%;
  background-color: var(--color-main-background-secondary);
  .name {
    color: var(--color-main-text);
  }
}
</style>
